<template>
  <div id="app">
    <div v-if="false" id="nav">
      <router-link to="/home">Home</router-link>
      <router-link to="/tenant">合作一</router-link>
      <router-link to="/time">合作二</router-link>
      <router-link to="/partner">合作二</router-link>
    </div>
    <router-view />
  </div>
</template>

<script>
export default {
    created() {
        console.log()
        if (this.getQueryVariable('token')) {
            localStorage.setItem('token', this.getQueryVariable('token'))
            window.location.href = 'http://lj-bus.unmcc.com/#/home'
            // window.location.href = 'http://192.168.8.107:8081/#/home'
            // alert('登录成功')
        } else {
            if (!localStorage.getItem('token')) {
                console.log(404)
                // alert('登录失败')
            }
        }
    },
    methods: {
        getQueryVariable: function getQueryVariable(variable) {
            const query = window.location.search.substring(1)
            const vars = query.split('&')
            for (let i = 0; i < vars.length; i++) {
                const pair = vars[i].split('=')
                if (pair[0] === variable) {
                    return pair[1]
                }
            }
            return false
        }
    }
}
</script>

<style lang="less">
body,html{
  padding: 0;
  margin: 0;
  background-color: #fff;
}
</style>
